home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / Gui4Cli / Dir / dir.xpack < prev   
Encoding:
Text File  |  1980-01-03  |  5.7 KB  |  207 lines

  1. G4C
  2.  
  3. ;
  4. ; April '97 by Brian Jones
  5. ; XPK packing and unpacking gui for D. Keletsekis' Dir.gc
  6. ;
  7. ; This gui needs xpack (from the XPK distribution in the c drawer)
  8. ; in C:
  9. ; Passwords are supported but not well trapped, if something won't
  10. ; unpack it probably needs a password (but it won't tell you).
  11. ; Also, not all xpk sub-libraries support password encoding so
  12. ; if you are trying to apply a password and it won't work the 
  13. ; sub-library probably can't use one.
  14. ;
  15.  
  16. WINBIG -1 11 486 174   "Choose Packer -- Reload to get new files"
  17. WinType 11110001
  18. nofontsense
  19. varpath dir.gc
  20.  
  21. xOnLoad
  22. ;run 'Sys:Utilities/IP'                   ;only if you run k-p koljonen's
  23. xid = $$lv.id                             ;transparent xpk handler
  24. xdir = $$lv.dir
  25. gosub dir.xpack startup1                  ;load the listviews
  26. gosub dir.xpack startup
  27. run 'resident c:xpack pure add'
  28.  
  29. xOnReload                       
  30. xid = $$lv.id
  31. xdir = $$LV.DIR
  32. gosub dir.xpack startup1           
  33. gosub dir.xpack startup
  34.  
  35. xOnClose
  36. GuiQuit dir.xpack
  37.  
  38. xOnQuit                           ;cleanup
  39. run 'resident xpack remove'
  40. ;run 'Sys:Utilities/IP'           ;needed only if you use IP (see above)
  41.  
  42. ;The Listviews
  43. ;-------------------------------------------------------------
  44. XLISTVIEW 174 19 160 129  "" rawcmprsr "LIBS:Compressors" 0 DIR   ;see note
  45. GadID 1                                                           ;below
  46.  
  47. XLISTVIEW 5 16 150 146    "" cmprsr "" 0 TXT
  48. GadID 2
  49. update dir.xpack 4 $cmprsr
  50.  
  51. XLISTVIEW 161 32 320 131  "" xfile "" 10 MULTI
  52. GadID 3
  53.  
  54. ;The Gadgets
  55. ;------------------------------------------------------
  56. TEXT 3 1 150 13  "RAKE" 100 BOX
  57. GadID 4
  58.  
  59. XHSLIDER 54 159 64 12  "Mode?" xmode 0 100 100 "%ld%%"
  60. GadID 5
  61.  
  62. XCYCLER 161 1 80 13  "" xchoice
  63. GadID 6
  64. CStr Pack pack
  65. CStr Unpack unpack
  66. gosub dir.xpack makegui
  67.  
  68. XBUTTON 404 1 77 13  "GO!"
  69. GadID 7
  70. lvuse dir.xpack 3
  71. lvgo #0
  72. xfile = $$lv.rec
  73. xcount = 0
  74. if $xchoice = pack
  75.    appvar cmprsr '.'
  76.    appvar cmprsr $xmode
  77. endif
  78. if $xpass = ""
  79.     psswrd = ""
  80. else
  81.     psswrd = PASSWORD
  82. endif
  83. guiwindow dir.xpack wait
  84. Launch 1 'xpack $xfile $xmthd $cmprsr $psswrd $xpass ALL QUIET'
  85.  
  86. XBUTTON 324 1 77 13        "CANCEL"
  87. GadID 8
  88. guiClose dir.xpack
  89.  
  90. XBUTTON 244 1 77 13        "Reload"
  91. GadID 9
  92. xid  = $$lv.id           
  93. xdir = $$LV.DIR
  94. lvuse dir.xpack 3
  95. lvclear
  96. gosub dir.xpack startup
  97.  
  98. GAUGE 162 158 319 13  IN RIDGE 2 0 0
  99. GadID 10 
  100.  
  101. XTEXTIN 244 16 157 14  "Password " xpass "" 100
  102. GadID 11
  103.  
  104. ;-----------------------------------------------------------
  105. xOnReturn 1                 ;continuation of processing if there is more     
  106. lvuse dir.xpack 3           ;than one file.
  107. counter xcount inc 1
  108. if $xcount < $$lv.total     ; not the end of the lv
  109.       xpercent == $xcount * 100
  110.       xpercent == $xpercent / $xfilecount
  111.       update dir.xpack 10 $xpercent
  112.       lvgo next  ;#$xcount
  113.       xfile = $$lv.rec
  114.       Launch 1 'xpack $xfile $xmthd $cmprsr $psswrd $xpass ALL QUIET'
  115. else
  116. guiwindow dir.xpack resume
  117. update dir.xpack 10 0
  118. setwintitle dir.xpack 'Finished - Choose new files or quit'
  119. lvuse dir.gc $xid
  120. lvdir refresh
  121. endif
  122.  
  123. ;--------------------------------------------------------------
  124. xroutine startup                ;setup of the list of files to be packed
  125. setscreen dir.xpack $*SCREEN    ;or unpacked
  126. xfilecount = 0
  127. lvuse dir.gc $xid
  128. lvmulti first
  129. if $lv_file = ""
  130.    ezreq "How's about choosing\nsome files first ?" 'Oh yeah..' ""
  131.    stop
  132. endif
  133. while $lv_file > ""
  134.   extract lv_file ext tempinf
  135.     if $tempinf != ".info"         ;;this is a filter for .info files so
  136.       counter xfilecount inc 1      ;they won't be packed and become
  137.       lvuse dir.xpack 3             ;unreadable
  138.       lvadd $lv_file
  139.       lvuse dir.gc $xid
  140.     endif
  141.   lvmulti next
  142. endwhile
  143. setgad dir.xpack 1 HIDE
  144. guiopen dir.xpack
  145.  
  146. xRoutine startup1               ;set up of the list of xpk sub-libraries.
  147. xchoice = pack                  ;this expects a normal xpk installation
  148. xmthd = METHOD                  ;(Libs:Compressors) if not, change the 
  149. cmprsr = RAKE                   ;place that listview 1 looks for the
  150. xmode = 100                     ;sub-libraries (see listviews section
  151. psswrd = ""                     ;above) 
  152. xpass = ""
  153. lvuse dir.xpack 2
  154. lvclear
  155. LVuse dir.xpack 1               
  156. LVdir all                       
  157. lvmulti first                    
  158. while $rawcmprsr > ""             
  159.    tempcmp = $$LV.REC
  160.    cutvar tempcmp CUT CHAR 3 dummy1
  161.    cutvar tempcmp CUT CHAR -8 dummy2
  162.    lvuse dir.xpack 2
  163.    lvadd $tempcmp
  164.    lvuse dir.xpack 1
  165.    lvmulti next
  166. endwhile
  167.  
  168. xroutine makegui                   ;this could be easier if I put the
  169. if $xchoice = pack                 ;xpk libraries list on the right
  170.    setgad dir.xpack 2 show         ;instead of the left but I like
  171.    setgad dir.xpack 4 show         ;it better that way
  172.    setgad dir.xpack 5 show
  173.    changearg dir.xpack 3 0 161
  174.    changearg dir.xpack 6 0 161
  175.    changearg dir.xpack 7 0 404
  176.    changearg dir.xpack 8 0 324
  177.    changearg dir.xpack 9 0 244
  178.    changearg dir.xpack 10 0 162
  179.    changearg dir.xpack 11 0 244
  180.    changegad dir.xpack 0 -1 11 486 174 ""
  181.    setwintitle dir.xpack "Choose Packer -- Reload to get new files"
  182.    xmthd = METHOD                 ;reset some stuff now that we're back in
  183.    xmode = 100                    ;pack mode
  184.    update dir.xpack 5 100
  185.    if $cmprsr = ""
  186.       cmprsr = RAKE
  187.    endif
  188. else
  189.    setgad dir.xpack 2 hide
  190.    setgad dir.xpack 4 hide
  191.    setgad dir.xpack 5 hide
  192.    changearg dir.xpack 3 0 2
  193.    changearg dir.xpack 6 0 2
  194.    changearg dir.xpack 7 0 245
  195.    changearg dir.xpack 8 0 165
  196.    changearg dir.xpack 9 0 85
  197.    changearg dir.xpack 10 0 4
  198.    changearg dir.xpack 11 0 85
  199.    changegad dir.xpack 0 -1 11 326 174 ""
  200.    setwintitle dir.xpack "Unpack -- Reload for new files"
  201.    xmthd = ""           ;these are not needed in decompress mode
  202.    cmprsr = ""          ;
  203. endif
  204. redraw dir.xpack
  205.  
  206.  
  207.